import React, { useEffect, useState } from 'react';
import { Modal, Descriptions, message, Tabs, Row, Col, Button, Badge, Tag } from 'antd';
import { getProductRecordDetail } from '@/pages/laborSupervision/projectRecord/service';
import { getProjectDetail, guaranteeList } from '@/pages/constructionManage/service';
import { accDiv, formatDateIOS, isAssetTypeAnImage } from '@/utils/utils';
import { getMarginAccountDetail, getProjectCategory } from '@/services/public';
import FileRender from '../fileRender';
import styles from './index.less';
import FileOpen from '@/components/FileIframOpen';
import ProjectPersonInfo from '@/components/projectPersonInfo';
import AttendanceRecord from '@/pages/laborSupervision/laborWageManageDetail/attendanceRecord';
import WageRecord from '@/pages/laborSupervision/laborWageManageDetail/wageRecord';
import OpenMap from '@/components/TianMap/openMap';
import PermissionManage from '@/components/PermissionManage';
import city from '@/components/SRCity/data';
import UploadLega from '../UploadLega';
import RegisterList from '../registerList';
import RenderMoreFile from '../FileMoreRender';
const noticeColorList = ['success', 'warning', 'error'];
import HistoryAccount from './HistoryAccount'
import Payment from './Payment'

const { TabPane } = Tabs;
const delayStatusText = ['-', '100%', '50%', '150%', '200%'];
const marginTypeText = ['-', '保证金', '保函', '保单'];
const marginStatusText = ['未缴纳', '正常缴纳', '保证金不足', '已注销', '缴纳中'];

interface ProducDetailProps {
  edit?: boolean;
  visible: boolean;
  projectInfo: any;
  cancel: () => void;
  origin: 'project' | 'bank' | 'cmProject' | 'importProject' | 'successProject';
}

const ProducDetail: React.FC<ProducDetailProps> = ({ visible, cancel, projectInfo, origin, edit }) => {
  const [detailInfo, setDetailInfo] = useState<any>({});
  const [showLega, handleLega] = useState<boolean>(false);
  const [bType, setBType] = useState<any>();
  const [ppKey, setPpKey] = useState<any>('2');
  const [guaranteeLists, setGuaranteeLists] = useState<any>([]);
  const [fileUrlVisible, setFileUrlVisible] = useState<boolean>(false);
  const [fileUrl, setFileUrl] = useState<any>('');
  const [category, setCategory] = useState<any[]>([]);

  const [historyVisible, setHistryVisible] = useState<boolean>(false);

  const getDetailInfo = async () => {
    const res =
      origin == 'project'
        ? await getProductRecordDetail({ id: projectInfo.id })
        : origin == 'bank'
          ? await getMarginAccountDetail({
            corpId: projectInfo.corpId,
            projectId: projectInfo.projectId,
          })
          : origin == 'cmProject'
            ? await getProjectDetail({ id: projectInfo.id })
            : origin == 'importProject' ? await getProductRecordDetail({ id: projectInfo.projectId }) : origin == 'successProject' ? await getProductRecordDetail({ id: projectInfo.dbProjectId }) : {};
    if (res && res.success) {
      if (res.data.projectStatus) {
        switch (res.data.projectStatus) {
          case 1:
            res.data.projectStatus = '在建'
            break;
          case 2:
            res.data.projectStatus = '筹备'
            break;
          case 3:
            res.data.projectStatus = '停工'
            break;
          case 4:
            res.data.projectStatus = '完工'
            break;
          default:
            break;
        }
      }
      setDetailInfo(res.data);
    } else {
      message.error(res.errMsg);
    }
  };

  const categoryList = async () => {
    const res = await getProjectCategory();
    if (res.success) {
      const c: any[] = [];
      res.data.map((el: any) => {
        const cc = {
          label: el.name,
          value: el.id,
          key: el.id,
        };
        c.push(cc);
      });
      setCategory(c);
    } else {
      message.error(res.errMsg || '获取类目失败,请刷新页面重试');
    }
  };

  const getCategory = (value: any) => {
    let label = '-'
    category.forEach((item: any) => {
      if (value == item.value) {
        label = item.label
      }
    })
    return label
  }

  useEffect(() => {
    getDetailInfo();
    categoryList();
  }, []);

  // 施工合同
  const marginAccountInfo = detailInfo.marginAccount || {};

  const cityName = (code: any) => {
    if (code) {
      const cdata = city.filter(item => item.value == code);
      if (cdata.length > 0) {
        console.log(cdata, 'cdata');

        return cdata[0].label;
      }
      return ''
    }
    return ''
  }

  const legalInfo = (value: any) => {
    if (value) {
      const legalRep = JSON.parse(value);
      let reInfo = '-';
      if (legalRep.legalRepName) {
        reInfo = legalRep.legalRepName;
      }
      if (legalRep.legalRepPhone) {
        reInfo = `${reInfo}/${legalRep.legalRepPhone}`;
      }
      return reInfo;
    }
    return '-'
  }
  const getOld = async () => {
    let res = await guaranteeList({
      marginAccountId: marginAccountInfo.id
    })
    if (res.success) {
      let fileId = res.data.map((item: any) => {
        return item.fileId
      })
      let fileUrl = res.data.map((item: any) => {
        return item.fileUrl
      })
      setFileUrl(fileUrl.join(','));
      setFileUrlVisible(true);
      setGuaranteeLists(res.data)
    }
  }

  const specialAccountStatus = (
    <span>
      {detailInfo.specialAccountStatus == 0 && <Badge status="default" text="未开户" />}
      {detailInfo.specialAccountStatus == 1 && <Badge status="processing" text="开户申请中" />}
      {detailInfo.specialAccountStatus == 2 && <Badge status="success" text="已开户" />}
      {detailInfo.specialAccountStatus == 3 && (!detailInfo.specialAccount || detailInfo.specialAccount.type != '-2') && <Badge status="default" text="已销户" />}
      {detailInfo.specialAccountStatus == 4 && (!detailInfo.specialAccount || detailInfo.specialAccount.type != '-2') && <Badge status="processing" text="销户申请中" />}
      {detailInfo.specialAccountStatus == 3 && detailInfo.specialAccount && detailInfo.specialAccount.type == '-2' && <Badge status="processing" text="已销户" />}
      {detailInfo.specialAccountStatus == 4 && detailInfo.specialAccount && detailInfo.specialAccount.type == '-2' && <Badge status="processing" text="变更中" />}
      {detailInfo.specialAccountStatus == 5 && <Badge status="processing" text="银行已受理" />}
    </span>
  );

  return (
    <>
      <Modal title={'项目详情'} onCancel={cancel} visible={visible} width="1000px" footer={null}>
        <Tabs defaultActiveKey="1">
          <TabPane tab="基本信息" key="1">
            <Descriptions
              title={detailInfo.projectName}
              column={{ md: 2, sm: 2, xs: 1 }}
              labelStyle={{ width: '120px' }}
            >
              <Descriptions.Item label="所属劳监局">
                {detailInfo.departmentName || '-'}
              </Descriptions.Item>
              <Descriptions.Item label="项目编号">{detailInfo.projectNo || '-'}</Descriptions.Item>
              <Descriptions.Item label="项目状态">{detailInfo.projectStatus || '-'}</Descriptions.Item>
              <Descriptions.Item label="项目种类">{getCategory(detailInfo.categoryId) || '-'}</Descriptions.Item>


            </Descriptions>
            <Descriptions
              column={{ md: 3, sm: 3, xs: 1 }}
              labelStyle={{ width: '120px' }}
            >
              <Descriptions.Item label="建设单位">
                {detailInfo.tender || '-'}
                {detailInfo.headName ? `；负责人：${detailInfo.headName}` : ''}
                {detailInfo.headPhone ? `/${detailInfo.headPhone}` : ''}
              </Descriptions.Item>
              <Descriptions.Item
                label="建设单位负责人任命书"
                contentStyle={{ overflow: 'hidden' }}
              >
                {(detailInfo.constructionHeadUserJsonArray && JSON.parse(detailInfo.constructionHeadUserJsonArray)[0].appointFileIdUrl) ?
                  <RenderMoreFile title="建设单位负责人任命书" fielUrl={JSON.parse(detailInfo.constructionHeadUserJsonArray)[0].appointFileIdUrl} /> : '-'
                }
              </Descriptions.Item>
              <Descriptions.Item
                label="建设单位负责人承诺书"
                contentStyle={{ overflow: 'hidden' }}
              >
                {(detailInfo.constructionHeadUserJsonArray && JSON.parse(detailInfo.constructionHeadUserJsonArray)[0].workPromiseFileUrl) ?
                  <RenderMoreFile title="建设单位负责人承诺书" fielUrl={JSON.parse(detailInfo.constructionHeadUserJsonArray)[0].workPromiseFileUrl} /> : '-'
                }
              </Descriptions.Item>
              <Descriptions.Item label="施工单位">
                {detailInfo.corpName || '-'}
                {(detailInfo.ownerHeadUserJsonArray && JSON.parse(detailInfo.ownerHeadUserJsonArray).length > 0 && JSON.parse(detailInfo.ownerHeadUserJsonArray)[0].userName) ? `；负责人：${JSON.parse(detailInfo.ownerHeadUserJsonArray)[0].userName}` : ''}
                {(detailInfo.ownerHeadUserJsonArray && JSON.parse(detailInfo.ownerHeadUserJsonArray).length > 0 && JSON.parse(detailInfo.ownerHeadUserJsonArray)[0].userPhone) ? `/${JSON.parse(detailInfo.ownerHeadUserJsonArray)[0].userPhone}` : ''}
              </Descriptions.Item>

              <Descriptions.Item
                label="施工单位负责人任命书"
                contentStyle={{ overflow: 'hidden' }}
              >
                {(detailInfo.ownerHeadUserJsonArray && JSON.parse(detailInfo.ownerHeadUserJsonArray)[0].appointFileIdUrl) ?
                  <RenderMoreFile title="施工单位负责人任命书" fielUrl={JSON.parse(detailInfo.ownerHeadUserJsonArray)[0].appointFileIdUrl} /> : '-'
                }
              </Descriptions.Item>
              <Descriptions.Item
                label="施工单位负责人承诺书"
                contentStyle={{ overflow: 'hidden' }}
              >
                {(detailInfo.ownerHeadUserJsonArray && JSON.parse(detailInfo.ownerHeadUserJsonArray)[0].workPromiseFileUrl) ?
                  <RenderMoreFile title="施工单位负责人承诺书" fielUrl={JSON.parse(detailInfo.ownerHeadUserJsonArray)[0].workPromiseFileUrl} /> : '-'
                }
              </Descriptions.Item>


            </Descriptions>
            <Descriptions
              column={{ md: 2, sm: 2, xs: 1 }}
              labelStyle={{ width: '120px' }}
            >
              <Descriptions.Item label="施工单位编号">
                {detailInfo.corpCode || '-'}
              </Descriptions.Item>
              <Descriptions.Item label="经 办 人">{detailInfo.userName || '-'}</Descriptions.Item>
              <Descriptions.Item label="经办人电话">
                {detailInfo.userPhone || '-'}
              </Descriptions.Item>
              <Descriptions.Item label="经办人身份证">
                {detailInfo.idCardNo || '-'}
              </Descriptions.Item>
              <Descriptions.Item label="法人信息">
                {legalInfo(detailInfo.legalRepInfo)}
              </Descriptions.Item>
              <Descriptions.Item label="中标价金额/发包价金额">
                {detailInfo.guaranteeAmount
                  ? accDiv(detailInfo.guaranteeAmount || 0, 1000000) + '（万元）'
                  : '-'}
              </Descriptions.Item>
              <Descriptions.Item label="拟开工时间">
                {detailInfo.startTime ? formatDateIOS(detailInfo.startTime) : '-'}
              </Descriptions.Item>
              <Descriptions.Item label="拟竣工时间">
                {detailInfo.endTime ? formatDateIOS(detailInfo.endTime) : '-'}
              </Descriptions.Item>
              <Descriptions.Item label="中标通知书编号">
                {detailInfo.notificationNo}
              </Descriptions.Item>
              <Descriptions.Item label="开工许可证单位">
                {detailInfo.constructionPermitName ? detailInfo.constructionPermitName : '-'}
              </Descriptions.Item>


              <Descriptions.Item span={2} label="开工令/施工许可证" contentStyle={{ overflow: 'hidden' }}>
                {
                  detailInfo.constructionPermitFileUrl ? <RenderMoreFile title="开工令/施工许可证" fielUrl={detailInfo.constructionPermitFileUrl} /> : '-'
                }

              </Descriptions.Item>
              <Descriptions.Item label="开工令开始时间">
                {detailInfo.constructionPermitStart ? formatDateIOS(detailInfo.constructionPermitStart) : '-'}
              </Descriptions.Item>
              <Descriptions.Item label="开工令结束时间">
                {detailInfo.constructionPermitEnd ? formatDateIOS(detailInfo.constructionPermitEnd) : '-'}
              </Descriptions.Item>
              <Descriptions.Item label="项目所在地" span={2}>
                {cityName(`${detailInfo.county}`)}
              </Descriptions.Item>
              <Descriptions.Item label="项目地址" span={2}>
                <div style={{ width: '100%' }}>
                  <div>{detailInfo.address}</div>
                  {detailInfo.addressCoordinate && (
                    <OpenMap
                      value={detailInfo.addressCoordinate}
                      mapStyle={{ width: '50%', height: '200px' }}
                    />
                  )}
                </div>
              </Descriptions.Item>
              {detailInfo && detailInfo.businessLicenseUrl && (
                <Descriptions.Item
                  label="企业营业执照"
                  contentStyle={{ overflow: 'hidden' }}
                  span={2}
                >
                  <RenderMoreFile title="企业营业执照" fielUrl={detailInfo.businessLicenseUrl} />
                </Descriptions.Item>
              )}
              {detailInfo && detailInfo.constructionContractUrl && (
                <Descriptions.Item span={2} label="施工合同" contentStyle={{ overflow: 'hidden' }}>
                  <RenderMoreFile title="施工合同" fielUrl={detailInfo.constructionContractUrl} />
                </Descriptions.Item>
              )}
              {detailInfo.notificationUrl ? (
                <Descriptions.Item
                  label="中标通知书/发包告知表"
                  contentStyle={{ overflow: 'hidden' }}
                  span={2}
                >
                  <RenderMoreFile title="中标通知书/发包告知表" fielUrl={detailInfo.notificationUrl} />
                </Descriptions.Item>
              ) : null}
            </Descriptions>
          </TabPane>
          <TabPane tab="保证金信息" key="2">
            <Descriptions column={{ md: 2, sm: 2, xs: 1 }} labelStyle={{ width: '110px' }}>
              <Descriptions.Item label="申请人信息">
                {(marginAccountInfo.applyUserName || '') +
                  '/' +
                  (marginAccountInfo.applyUserPhone || '')}
              </Descriptions.Item>
              {marginAccountInfo.type && (
                <Descriptions.Item label="保证金类型">
                  {marginTypeText[marginAccountInfo.type]}
                </Descriptions.Item>
              )}
              <Descriptions.Item label="保证金状态">
                {marginStatusText[marginAccountInfo.marginStatus]}
              </Descriptions.Item>
              {marginAccountInfo.accountName && (
                <Descriptions.Item label="保证金账户名称">
                  {marginAccountInfo.accountName}
                </Descriptions.Item>
              )}
              <Descriptions.Item label="预警信息">
                {
                  detailInfo.warningRemark ? <Tag color={noticeColorList[detailInfo.warningStatus]}>
                    {' '}
                    <span style={{ whiteSpace: 'pre-wrap' }}>{detailInfo.warningRemark}</span>{' '}
                  </Tag> : '-'
                }

              </Descriptions.Item>


              {marginAccountInfo.applyAccount && (
                <Descriptions.Item label="保证金账户账号">
                  {marginAccountInfo.applyAccount}
                </Descriptions.Item>
              )}
              <Descriptions.Item label="金融机构">
                {marginAccountInfo.type == 1
                  ? marginAccountInfo.bankName
                  : (marginAccountInfo.guaranteeInfo &&
                    marginAccountInfo.guaranteeInfo.thirdPlatformName) ||
                  ''}
              </Descriptions.Item>
              <Descriptions.Item label="金融机构经办人">
                {marginAccountInfo.financialUserName}
              </Descriptions.Item>
              <Descriptions.Item label="经办人联系电话">
                {marginAccountInfo.financialUserPhone}
              </Descriptions.Item>
              {marginAccountInfo.delayStatus ? (
                <Descriptions.Item label="核定单比例">
                  {delayStatusText[marginAccountInfo.delayStatus]}
                </Descriptions.Item>
              ) : null}
              {marginAccountInfo.needPayAmount ? (
                <Descriptions.Item label="核定实缴金额">
                  {accDiv(detailInfo.marginAccount.needPayAmount, 1000000)}（万元）
                </Descriptions.Item>
              ) : null}
              <Descriptions.Item label="2年前承建项目凭证">
                {detailInfo.differentPaymentVoucherFileUrl ? (
                  <RenderMoreFile
                    title="2年前承建项目凭证"
                    fielUrl={detailInfo.differentPaymentVoucherFileUrl}
                  />
                ) : (
                  '无'
                )}
              </Descriptions.Item>
              {detailInfo.publicityFileUrl ? (
                <Descriptions.Item label="差异化公示文件">
                  <RenderMoreFile title="差异化公示文件" fielUrl={detailInfo.publicityFileUrl} />
                </Descriptions.Item>
              ) : null}
              {detailInfo.publicitySignFileUrl ? (
                <Descriptions.Item label="差异化公示文件(签字版)">
                  <RenderMoreFile title="差异化公示文件(签字版)" fielUrl={detailInfo.publicitySignFileUrl} />
                </Descriptions.Item>
              ) : null}

              {detailInfo.approvedFileUrl ? (
                <Descriptions.Item label="核定单附件">
                  <RenderMoreFile
                    title="核定单附件"
                    fielUrl={detailInfo.approvedFileUrl}
                  />
                </Descriptions.Item>
              ) : null}
              {marginAccountInfo.fixPaymentCertificateUrl ? (
                <Descriptions.Item label="保证金缴纳证明">
                  <RenderMoreFile
                    title="保证金缴纳证明"
                    fielUrl={marginAccountInfo.fixPaymentCertificateUrl}
                  />
                </Descriptions.Item>
              ) : null}
              {marginAccountInfo.tripartiteAgreementMarginFileUrl && (
                <Descriptions.Item
                  label="农民工工资保证金账户协议"
                  contentStyle={{ overflow: 'hidden' }}
                >
                  <RenderMoreFile
                    title="农民工工资保证金账户协议"
                    fielUrl={marginAccountInfo.tripartiteAgreementMarginFileUrl}
                  />
                </Descriptions.Item>
              )}
              {marginAccountInfo.paymentVoucherUrl && (
                <Descriptions.Item label="缴纳凭证" contentStyle={{ overflow: 'hidden' }}>
                  <RenderMoreFile title="缴纳凭证" fielUrl={marginAccountInfo.paymentVoucherUrl} />
                </Descriptions.Item>
              )}
              {marginAccountInfo.guaranteeInfo && marginAccountInfo.guaranteeInfo.fileUrl && (
                <Descriptions.Item
                  label={marginAccountInfo.type == 2 ? '保函' : '保单'}
                  contentStyle={{ overflow: 'hidden' }}
                >
                  <RenderMoreFile
                    title={marginAccountInfo.type == 2 ? '保函' : '保单'}
                    fielUrl={marginAccountInfo.guaranteeInfo.fileUrl}
                  />

                </Descriptions.Item>
              )}
              {
                // marginAccountInfo && (
                <Descriptions.Item
                  label={marginAccountInfo.type == 2 ? '历史保函' : '历史保单'}
                  contentStyle={{ overflow: 'hidden' }}
                >
                  <a
                    onClick={() => {
                      getOld()
                    }}
                  >查看</a>
                </Descriptions.Item>
                // )
              }

              {marginAccountInfo.noArrearsFileUrl && (
                <Descriptions.Item label="销户公告公示文件" contentStyle={{ overflow: 'hidden' }}>
                  <RenderMoreFile
                    title="销户公告公示文件"
                    fielUrl={marginAccountInfo.noArrearsFileUrl}
                  />
                </Descriptions.Item>
              )}
              {marginAccountInfo.noArrearsFileSealUrl && (
                <Descriptions.Item label="盖章公告公示">
                  <RenderMoreFile
                    title="盖章公告公示"
                    fielUrl={marginAccountInfo.noArrearsFileSealUrl}
                  />
                </Descriptions.Item>
              )}
              {marginAccountInfo.reportFileUrl && (
                <Descriptions.Item label="5方验收报告">
                  <RenderMoreFile
                    title="5方验收报告"
                    fielUrl={marginAccountInfo.reportFileUrl}
                  />
                </Descriptions.Item>
              )}
              {marginAccountInfo.cancelNoticeFileUrl && (
                <Descriptions.Item label="劳监销户函" contentStyle={{ overflow: 'hidden' }}>
                  <RenderMoreFile
                    title="劳监销户函"
                    fielUrl={marginAccountInfo.cancelNoticeFileUrl}
                  />
                </Descriptions.Item>
              )}
              {marginAccountInfo.cancelNoticeProveFileUrl && (
                <Descriptions.Item label="销户证明书" contentStyle={{ overflow: 'hidden' }}>
                  <RenderMoreFile
                    title="销户证明书"
                    fielUrl={marginAccountInfo.cancelNoticeProveFileUrl}
                  />
                </Descriptions.Item>
              )}
              {
                marginAccountInfo.responsibilityFileUrl && (
                  <Descriptions.Item label="甲方责任书" contentStyle={{ overflow: 'hidden' }}>
                    <RenderMoreFile
                      title="甲方责任书"
                      fielUrl={marginAccountInfo.responsibilityFileUrl}
                    />
                  </Descriptions.Item>
                )
              }
              {
                marginAccountInfo.commitmentFileUrl && (
                  <Descriptions.Item label="乙方承诺书" contentStyle={{ overflow: 'hidden' }}>
                    <RenderMoreFile
                      title="乙方承诺书"
                      fielUrl={marginAccountInfo.commitmentFileUrl}
                    />
                  </Descriptions.Item>
                )
              }
            </Descriptions>
          </TabPane>
          <TabPane tab="工资专户账户信息" key="3">
            <Descriptions column={{ md: 2, sm: 2, xs: 1 }} labelStyle={{ width: '110px' }}>
              <Descriptions.Item label="申请人">
                {(detailInfo.specialAccount && detailInfo.specialAccount.applyUserName) || ''}
                {detailInfo.specialAccount && detailInfo.specialAccount.applyUserMobile
                  ? `/${detailInfo.specialAccount.applyUserMobile}`
                  : ''}
              </Descriptions.Item>
              <Descriptions.Item label="账户状态">{specialAccountStatus}</Descriptions.Item>
              <Descriptions.Item label="历史账户">
                <Button size='small' type="primary" onClick={() => {
                  setHistryVisible(true)
                }} >
                  查看
                </Button>
              </Descriptions.Item>

              <Descriptions.Item label="账户名称">
                {(detailInfo.specialAccount && detailInfo.specialAccount.accountName) || '-'}
              </Descriptions.Item>
              <Descriptions.Item label="账户账号">
                {(detailInfo.specialAccount && detailInfo.specialAccount.applyAccount) || '-'}
              </Descriptions.Item>
              <Descriptions.Item label="开户行信息">
                {(detailInfo.specialAccount && detailInfo.specialAccount.bankName) || '-'}
              </Descriptions.Item>
              <Descriptions.Item label="银行经办人/电话">
                {detailInfo.specialAccount && detailInfo.specialAccount.bankAgentUserName || '-'} {detailInfo.specialAccount && detailInfo.specialAccount.bankAgentUserMobile || ''}
              </Descriptions.Item>
              <Descriptions.Item label="农民工工资专户协议">
                {detailInfo.specialAccount &&
                  detailInfo.specialAccount.tripartiteAgreementSpecialFileUrl ? (
                  <RenderMoreFile
                    title="农民工工资专户协议"
                    fielUrl={detailInfo.specialAccount.tripartiteAgreementSpecialFileUrl}
                  />
                ) : '-'}
              </Descriptions.Item>


              <Descriptions.Item label="工资专户开户回执单">
                {detailInfo.specialAccount &&
                  detailInfo.specialAccount.accountOpeningReceiptFileUrl ? (
                  <RenderMoreFile
                    title="工资专户开户回执单"
                    fielUrl={detailInfo.specialAccount.accountOpeningReceiptFileUrl}
                  />
                ) : '-'}
              </Descriptions.Item>


              {detailInfo.specialAccount && detailInfo.specialAccount.noArrearsFileUrl && (
                <Descriptions.Item label="公示照片">
                  <RenderMoreFile
                    title="公示照片"
                    fielUrl={detailInfo.specialAccount.noArrearsFileUrl}
                  />
                </Descriptions.Item>
              )}
              {detailInfo.specialAccount && detailInfo.specialAccount.noArrearsFileSealUrl && (
                <Descriptions.Item label="盖章公告公示">
                  <RenderMoreFile
                    title="盖章公告公示"
                    fielUrl={detailInfo.specialAccount.noArrearsFileSealUrl}
                  />
                </Descriptions.Item>
              )}
              {detailInfo.specialAccount && detailInfo.specialAccount.reportFileUrl && (
                <Descriptions.Item label="5方验收报告">
                  <RenderMoreFile
                    title="5方验收报告"
                    fielUrl={detailInfo.specialAccount.reportFileUrl}
                  />
                </Descriptions.Item>
              )}
              {detailInfo.specialAccount && detailInfo.specialAccount.cancelFileUrl && (
                <Descriptions.Item label="专户销户申请书">
                  <RenderMoreFile
                    title="专户销户申请书"
                    fielUrl={detailInfo.specialAccount.cancelFileUrl}
                  />
                </Descriptions.Item>
              )}
              {detailInfo.specialAccount && detailInfo.specialAccount.cancelPromiseFileUrl && (
                <Descriptions.Item label="专户销户承诺书">
                  <RenderMoreFile
                    title="专户销户承诺书"
                    fielUrl={detailInfo.specialAccount.cancelPromiseFileUrl}
                  />
                </Descriptions.Item>
              )}
              {detailInfo.specialAccount && detailInfo.specialAccount.changeSpecialAccountFileUrl && (
                <Descriptions.Item label="专户变更申请书">
                  <RenderMoreFile
                    title="专户变更申请书"
                    fielUrl={detailInfo.specialAccount.changeSpecialAccountFileUrl}
                  />
                </Descriptions.Item>
              )}
              {detailInfo.specialAccount && detailInfo.specialAccount.cancelNoticeFileUrl && (
                <Descriptions.Item label="劳监销户函">
                  <RenderMoreFile
                    title="劳监销户函"
                    fielUrl={detailInfo.specialAccount.cancelNoticeFileUrl}
                  />
                </Descriptions.Item>
              )}
              {detailInfo.specialAccount && detailInfo.specialAccount.cancelNoticeProveFileUrl && (
                <Descriptions.Item label="金融机构销户证明">
                  <RenderMoreFile
                    title="金融机构销户证明"
                    fielUrl={detailInfo.specialAccount.cancelNoticeProveFileUrl}
                  />
                </Descriptions.Item>
              )}
              {marginAccountInfo.responsibilityFileUrl && (
                <Descriptions.Item label="建设单位责任书" contentStyle={{ overflow: 'hidden' }}>
                  <RenderMoreFile
                    title="建设单位责任书"
                    fielUrl={marginAccountInfo.responsibilityFileUrl}
                  />
                </Descriptions.Item>
              )}
              {
                marginAccountInfo.commitmentFileUrl && (
                  <Descriptions.Item label="施工单位承诺书" contentStyle={{ overflow: 'hidden' }}>
                    <RenderMoreFile
                      title="施工单位承诺书"
                      fielUrl={marginAccountInfo.commitmentFileUrl}
                    />
                  </Descriptions.Item>
                )
              }
            </Descriptions>
            <div>
              {detailInfo.specialAccountWarnNotifyFileUrl ||
                detailInfo.specialAccountWarnAmendFileUrl ? (
                <Descriptions title="法律文书">
                  <Descriptions.Item label="调查询问通知书">
                    <RenderMoreFile
                      title="调查询问通知书"
                      fielUrl={detailInfo.specialAccountWarnNotifyFileUrl}
                    />
                  </Descriptions.Item>
                  <Descriptions.Item label="改正指令书">
                    <RenderMoreFile
                      title="改正指令书"
                      fielUrl={detailInfo.specialAccountWarnAmendFileUrl}
                    />
                  </Descriptions.Item>
                </Descriptions>
              ) : null}
              {edit && detailInfo.specialAccountStatus == 0 && (
                <div style={{ textAlign: 'center', marginTop: '20px' }}>
                  <PermissionManage
                    type="button"
                    key="manager"
                    onClick={() => {
                      setBType(1);
                      handleLega(true);
                    }}
                    className={styles.action}
                    text="下发法律文书"
                    perm="OA_PROJECT_MANAGER_URGE"
                  />
                </div>
              )}
            </div>
          </TabPane>
          <TabPane tab="维权告示牌" key="4">
            {detailInfo.rightProtectionNoticeFileUrl ? (
              detailInfo.rightProtectionNoticeFileUrl.split(',').map((itemUrl: any) => {
                if (isAssetTypeAnImage(itemUrl)) {
                  return (
                    <div style={{ marginBottom: '12px' }}>
                      <img
                        src={itemUrl}
                        style={{ height: '60vh', width: '100%', objectFit: 'contain', border: '1px solid #e6e6e6' }}
                      />
                    </div>
                  );
                } else {
                  return (
                    <div style={{ marginBottom: '12px' }}>
                      <iframe src={itemUrl + `#toolbar=0`} style={{ width: '100%', height: '60vh' }} />
                    </div>
                  );
                }
              })
            ) : (
              <div className={styles.mession}>暂未上传</div>
            )}
            <div>
              {detailInfo.rightProtectionWarnNotifyFileUrl ||
                detailInfo.rightProtectionWarnAmendFileUrl ? (
                <Descriptions title="法律文书">
                  <Descriptions.Item label="调查询问通知书">
                    <RenderMoreFile
                      title="调查询问通知书"
                      fielUrl={detailInfo.rightProtectionWarnNotifyFileUrl}
                    />
                  </Descriptions.Item>
                  <Descriptions.Item label="改正指令书">
                    <RenderMoreFile
                      title="改正指令书"
                      fielUrl={detailInfo.rightProtectionWarnAmendFileUrl}
                    />
                  </Descriptions.Item>
                </Descriptions>
              ) : null}
              {detailInfo.rightProtectionNoticeFileUrl ? null : (
                <>
                  {edit && (
                    <div style={{ textAlign: 'center', marginTop: '20px' }}>
                      <PermissionManage
                        type="button"
                        key="manager"
                        onClick={() => {
                          setBType(2);
                          handleLega(true);
                        }}
                        className={styles.action}
                        text="下发法律文书"
                        perm="OA_PROJECT_MANAGER_URGE"
                      />
                    </div>
                  )}
                </>
              )}
            </div>
          </TabPane>
          <TabPane tab="工程支付款保函" key="9">
              <Payment projectInfo={detailInfo}>

              </Payment>
          </TabPane>
          <TabPane tab="项目人员信息" key="5">
            <ProjectPersonInfo
              projectInfo={detailInfo}
              key={detailInfo.lzUserWarnNotifyFileUrl}
              defaultKey={ppKey}
              onChange={(key) => {
                getDetailInfo();
                setPpKey(key);
              }}
            />
          </TabPane>
          <TabPane tab="考勤统计" key="6">
            <AttendanceRecord corpId={projectInfo.corpId} projectId={projectInfo.projectId} />
          </TabPane>
          <TabPane tab="工资表" key="7">
            <WageRecord corpId={projectInfo.corpId} projectId={projectInfo.projectId} />
          </TabPane>
          <TabPane tab="花名册/合同" key="8">
            <RegisterList origin={origin} projectInfo={projectInfo} />
          </TabPane>
        </Tabs>
      </Modal>
      {showLega && (
        <UploadLega
          visible={showLega}
          info={detailInfo}
          businessType={bType}
          cancel={() => {
            handleLega(false);
          }}
          onSubmit={() => {
            getDetailInfo();
            handleLega(false);
          }}
        />
      )}
      {historyVisible && (
        <HistoryAccount
          value={detailInfo}
          onCancel={
            () => { setHistryVisible(false) }
          }
          modalVisible={historyVisible}
        >

        </HistoryAccount>
      )}
      {fileUrlVisible && (
        <FileOpen
          title={''}
          fielUrl={fileUrl}
          modalVisible={fileUrlVisible}
          onCancel={() => {
            setFileUrlVisible(false);
            setFileUrl('');
          }}
        />
      )}
    </>
  );
};

export default ProducDetail;
